package training;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_7_4_Training {
    //找出第 K 个字符 II
    public char kthCharacter(long k, int[] ops) {
        char base = 'a';
        int mod = 26;
        int ans = 0;
        k-=1;
        for(int i = 0; k > 0; k >>= 1,i++) {
            if(ops[i] == 1 && (k&1) == 1) {
                ans = (ans + 1) % mod;
            }
        }
        return (char) (base + ans);
    }
}
